<?php 
require_once (__DIR__ . "/../../models/Addresses.php");
require_once (__DIR__ . "/../../models/Users.php");

$results = Addresses::GetAll();

?>
				<a href=<?= "Addresses/create" ?>><b>Add...</b></a>
				<table class="table table-bordered table-condensed table-hover table-striped">
					<tr>
						<th>Address Type</th><th>User Id</th><th>Actions</th>
					</tr>
					
					<?php while($row = $results->fetch_assoc()): 
						$user = Users::Get($row['userId']); ?>
						<tr>
							<td><?php echo Addresses::GetAddressType($row['addressType']); ?></td> <td><?php echo $user['firstName'].' '.$user['lastName'];?> </td>
							<td>
								<a href="<?= "$rootUrl/../W/Addresses/details/$row[id]" ?>">Details</a>
								<a href="<?= "$rootUrl/../W/Addresses/edit/$row[id]" ?>">Edit</a>
								<a href="<?= "$rootUrl/../W/Addresses/delete/$row[id]" ?>">Delete</a>
							</td>					
						</tr>
					<?php endwhile; ?>					
				</table>